﻿using System;
using System.Collections.Generic;
using System.Text;
using WeatherTest.Base;

namespace WeatherTest
{
    public class CurretConditionsDisplay : IObserver, IDisplayElement
    {
        public float _temp, _humidity;
        public void Display()
        {
            //throw new NotImplementedException();
            Console.WriteLine($"当前气象：{_temp}℃，{_humidity}% 湿度");
        }

        public void Update(float temp, float humidity, float pressure)
        {
            //throw new NotImplementedException();
            _temp = temp;
            _humidity = humidity;
            Display();

        }
        public CurretConditionsDisplay(ISubject weatherData)
        {
            weatherData.RegisterObserver(this);//注册订阅
        }

    }
}
